<%@ page contentType="text/html;charset=utf-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta name="format-detection" content="telephone=no">
    <title>驾驶证记分查询</title>
    <link type="text/css" href="<c:url value='/resource/wx/newcss/common.css'/>" rel="stylesheet"/>
    <link rel="stylesheet" href="<c:url value='/resource/wechat/css/frozen.css'></c:url>">
    <script type="text/javascript" src="<c:url value='/resource/js/jquery-2.0.min.js'/>"></script>
    <script src="<c:url value='/resource/js/common.js'/>" type="text/javascript"></script>
    <script type="text/javascript" src="https://gaapi.jl.gov.cn/web/resource/js/os.analystic-1.1.min.js"></script>
    <script type="text/javascript" src="https://pv.sohu.com/cityjson?ie=utf-8"></script>

    <script type="text/javascript">
        var cid = returnCitySN["cid"];
        var cip = returnCitySN["cip"];
        <%--var category = "${platform}";--%>
        cid = PrefixInteger(cid, 12);

        // 区域代码12位、不足前面补0
        function PrefixInteger(num, length) {
            return (Array(length).join('0') + num).slice(-length);
        }

        //日志组件初始化[必须调用]
        var logger = Oceansoft.analy.init({
            'appId': '1001',
            'regionId': cid,
            'category': ""
        });

        /**
         * Form表单日志统计
         */
//        function formSubmit() {
//
//            var ss = "{'tag':'100006','category':'" + category + "','oper':'','oper_id':'','ip':'" + cip + "','title':'','ext':''}";
//
//            logger.start();
//            logger.log('100006', logger.ACTION.CREATE, ss);
//            return true;
//        }

        function check() {
//            var pushId = $("#pushId").val().trim();
//            var pushType = $("#pushType").val().trim();
            var dabhFormat = /^(\d{15}$|^\d{18}$|^\d{17}(\d|X|x))$/;
            var fnFormat = /[a-z_A-Z_0-9]{12}/;
            var jtglywdxsfzhm = $("#jtglywdxsfzhm").val().trim().toUpperCase();
            firnull = "驾驶证编号不能为空";
            secnull = "档案编号不能为空";
            firformet = "请输入15/18位驾驶证编号";
            secformet = "请输入12位档案编号";
var html="";
            if (jtglywdxsfzhm == null || jtglywdxsfzhm == "") {
                toast(firnull, 1500);
                return false;
            }
            else if (!dabhFormat.test(jtglywdxsfzhm)) {
                //else if(jtglywdxsfzhm=="" || !(jtglywdxsfzhm.length == 15 || jtglywdxsfzhm.length == 18)){
                toast(firformet, 1500);
                return false;
            }  else {
                $.ajax({
                    url: "<c:url value='/api/query/ytLicense/points'/>",
                    type: "post",
                    data: {"jtglywdxsfzhm": jtglywdxsfzhm},

                    beforeSend: function () {
                        loading();
                    },
                    success: function (data) {
                        if (data.succ) {
                              var jf= data.data.LJJF;
                              html += '<div><p>&nbsp;&nbsp;&nbsp;累计记分: ' + jf+ '分</p></div>' ;
                            }
                        else{
                            html+="<p style='align:center'>&nbsp;&nbsp;&nbsp;没有获得数据</p>"
                        }
                        finish();
                        $("#result").html(data.msg);
                        $("#results").html(html);
                    },
                    error: function () {
                        check();
                    }
                });
            }

        }
        function hiden() {
            $(".toast").hide();
        }
    </script>

    <style type="text/css">
        body {
            font-family: "微软雅黑";
        }

        .body_bg {
            background-color: #efefef
        }

        .bg_fff {
            background-color: #FFFFFF
        }

        .text_main {
            padding: 10px;
            padding-top: 0px;
            font-size: 16px;
            color: #333;
        }

        .search_table {
            width: 100%;
            font-size: 16px;
            color: #333;
        }

        .search_table td {
            height: 30px;
            line-height: 30px;
            text-align: left;
            text-indent: 10px;
        }

        .ui-form-item label:not(.ui-switch):not(.ui-checkbox):not(.ui-radio) {
            width: 126px;
        }

        .toast {
            display: none;
            position: absolute;
            bottom: 100px;
            text-align: center;
            width: 170px;
            white-space: nowrap;
            font-size: 1.0em;
            padding: 0.7em 1em 0.9em 1em;
            color: #fff;
            border-radius: 4px;
            background-color: rgba(0, 0, 0, 0.67);
            border: none;
            width: -moz-fit-content;
            width: -webkit-fit-content;
            height: -webkit-fit-content;
            width: fit-content;
            margin-left: auto;
            margin-right: auto;
            border: 0;
            left: 0;
            right: 0;
        }
    </style>
</head>

<body ontouchstart>

<%--<header class="ui-header ui-header-positive ui-border-b">
    <i class="ui-icon-return" onclick="history.back()"></i>
    <h1>驾驶证记分查询</h1>
</header>--%>

<section class="ui-container">

    <div class="ui-form-item ui-border-b">
        <label>
            驾驶证编号：
        </label>
        <input id="jtglywdxsfzhm" name="jtglywdxsfzhm" type="text" maxLength="18" onfocus="hiden()"
               placeholder="请输入驾驶证编号" onkeyup="this.value=this.value.toUpperCase()"/>
    </div>
<%--    <div class="ui-form-item ui-border-b">
        <label style="width: 135px;">
            驾驶证档案编号：
        </label>
        <input id="dabh" name="dabh" type="text" maxLength="12" onfocus="hiden()" style="padding-left: 135px;"
               placeholder="请输入驾驶证档案编号" onkeyup="this.value=this.value.toUpperCase()"/>
    </div>--%>
    </form>
    </div>
    <div class="ui-btn-wrap">
        <%--<input type="hidden" name="pushId" id="pushId" value="${pushId}"/>--%>
        <%--<input type="hidden" name="pushType" id="pushType" value="${pushType}"/>--%>
        <button class="ui-btn-lg ui-btn-primary" id="btn_query" onclick="check();">
            查询
        </button>
    </div>
    <div id="toast" class="toast" style="font-size: 1.0em;"></div>
    <div id="result"></div>
    <div id="results"></div>
</section>
</body>

</html>